<?php
/**
 * PStandardObject
 * A basic object wich can be used to send values, to implements template contents, etc..
 *
 * @author Patrice Ferlet <metal3d@copix.org> 
 * @package utils
 * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License Version 3.0 (LGPLv3)
*/
class PStandardObject {

    protected $vars = array();

    public function __construct($datas=NULL){
        if ($datas === NULL){
            return;
        }

        /*if($datas instanceof stdClass){
            //TODO: navigate object
            return;
        }*/

        if(is_array($datas)){
            foreach($datas as $key=>$val){
                $this->vars[$key] = $val;
            }
            return;
        }
    }

    function __get($name){
        return isset($this->vars[$name]) ? $this->vars[$name] : null;
    }

    function __set($name,$value){
        $this->vars[$name] = $value;
    }

    function __isset($name){
        return isset($this->vars[$name]);
    }

    function merge($obj){
        
    }
}
